package com.zhou.springsecurityoauth2.controller;

import com.zhou.springsecurityoauth2.common.ResponseResult;
import com.zhou.springsecurityoauth2.entity.User;
import com.zhou.springsecurityoauth2.service.LoginServcie;
import lombok.RequiredArgsConstructor;

import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhou
 * @version 1.0
 * @date 2022/10/8 - 10 - 08 - 14:56
 * @description com.zhou.springsecurityoauth2.controller
 */

@RestController
@RequiredArgsConstructor
@RequestMapping

public class LoginController {

    private final LoginServcie loginServcie;


    @GetMapping("/user/login")
    public ResponseResult login(String username,String password){
        User user1 = new User();
        user1.setUserName(username);
        user1.setPassword(password);
        return loginServcie.login(user1);
    }


    @GetMapping("/user/logout")
    public ResponseResult logout(){
        return new ResponseResult(200,"嘿嘿");
    }

}
